﻿<UserControl x:Class="Shammateh.Win.UI.Views.Operation.WorkOperationView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:xoqalControls="clr-namespace:Xoqal.Presentation.Controls;assembly=Xoqal.Presentation"
             xmlns:xoqalConverter="clr-namespace:Xoqal.Presentation.Converters;assembly=Xoqal.Presentation"
             xmlns:wt="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="600">
    <UserControl.Resources>
        <xoqalConverter:DateTimeToNullableConverter x:Key="dateTimeToNullableConverter"/>
    </UserControl.Resources>
    <Grid>
        <GroupBox Grid.Row="1" Header="فعالیت" IsEnabled="{Binding IsInEditMode}" xoqalControls:ValidationHelper.ValidationController="{Binding ValidationController}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <TextBlock Margin="2">شروع:</TextBlock>
                <xoqalControls:DateTimePicker Margin="2" HorizontalAlignment="Left" Grid.Column="1" SelectedDateTime="{Binding CurrentItem.StartTime, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, Converter={StaticResource dateTimeToNullableConverter}}"/>

                <TextBlock Margin="2" Grid.Column="2">خاتمه:</TextBlock>
                <xoqalControls:DateTimePicker Margin="2" HorizontalAlignment="Left" Grid.Column="3" SelectedDateTime="{Binding CurrentItem.FinishTime, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, Converter={StaticResource dateTimeToNullableConverter}}"/>

                <TextBlock Margin="2" Grid.Row="1">پروژه:</TextBlock>
                <ComboBox Margin="2" Grid.Row="1" Grid.Column="1" ItemsSource="{Binding Projects}" SelectedValue="{Binding CurrentItem.Project, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"/>

                <TextBlock Margin="2" Grid.Row="1" Grid.Column="2">نوع فعالیت:</TextBlock>
                <ComboBox Margin="2" Grid.Row="1" Grid.Column="3" ItemsSource="{Binding ActivityTypes}" SelectedValue="{Binding CurrentItem.ActivityType, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"/>

                <TextBlock Margin="2" Grid.Row="2">فرد:</TextBlock>
                <ComboBox Margin="2" Grid.Row="2" Grid.Column="1" ItemsSource="{Binding Resources}" SelectedValue="{Binding CurrentItem.Resource, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"/>

                <TextBlock Margin="2" Grid.Row="2" Grid.Column="2">مخاطب:</TextBlock>
                <ComboBox Margin="2" Grid.Row="2" Grid.Column="3" ItemsSource="{Binding Audiences}" SelectedValue="{Binding CurrentItem.Audience, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"/>

                <TextBlock Margin="2" Grid.Row="3">توضیح:</TextBlock>
                <TextBox Margin="2" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding CurrentItem.Comment, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"/>

                <StackPanel Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,5,5" Grid.ColumnSpan="4">
                    <Button Command="{Binding AcceptChangesCommand}" Style="{StaticResource acceptButton}" />
                    <Button Command="{Binding CancelChangesCommand}" Style="{StaticResource cancelButton}" />
                </StackPanel>
            </Grid>
        </GroupBox>
    </Grid>
</UserControl>
